﻿@model IEnumerable<ToWaDBFirst.Models.message>

@{
    ViewBag.Title = "Index";
}
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
    $(function () {
        $("#fromDate").datepicker();
        $("#toDate").datepicker();
    });
    $(document).ready(function () {
        $("#myTable").tablesorter();
    }); 
	</script>

<h2>Index</h2>
@using (Html.BeginForm("Index", "Archive"))
{
    <table>
        <tr>
            <th>From Date</th>
            <th>To Date</th>
            <th>From Who</th>
            <th></th>
        </tr>
        <tr>
            <td><input type="text" id="fromDate" name="fromDate" /></td>
            <td><input type="text" id="toDate" name="toDate" /></td>
            <td><input type="text" name="fromWho" /></td>
            <td><input type="submit" value="Search" /></td>
        </tr>
    </table>
}
<table id="myTable">
<thead>
    <tr>
        <th>
            Title
        </th>
        <th>
            From
        </th>
        <th>
            Received
        </th>
    </tr>
    </thead>
    <tbody>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink(item.title, "Details", new { id = item.id})
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.user.username)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.posted)
        </td>
    </tr>
}
</tbody>
</table>
